import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: () => import('@/views/login.vue')
};

export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: () => import('@/views/error-page/404.vue')
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: () => import('@/views/error-page/403.vue')
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: () => import('@/views/error-page/500.vue')
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [
        { path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: () => import('@/views/own-space/own-space.vue') },
        { path: 'balance', title: '账户余额', name: 'account_balance', component: () => import('@/views/my-components/account/index.vue') },
        { path: 'system/notice-list', title: '通知详情', name: "notice_list", component: () => import('@/views/my-components/system/notice-list.vue')},
        { path: 'help', title: '帮助中心', name: 'help', component: () => import('@/views/my-components/help/index.vue')}
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/home',
        icon: 'speedometer',
        title: '首页',
        component: Main,
        children:[
            { path: '', title: '首页', name: 'home_index', component: () => import('@/views/home/home.vue') }
        ]
    },
    {
        path: '/order',
        icon: 'stats-bars',
        name: 'order',
        title: '订单数据',
        component: Main,
        children: [
            { path: 'count', icon: 'connection-bars', title: '订单数据统计', name: 'order_count', component: () => import('@/views/my-components/order/count.vue')},
            { path: 'refund', icon: 'clipboard', title: '退款记录', name: 'order_refund', component: ()=> import('@/views/my-components/order/refund.vue')}
        ]
     },
    {
        path: '/store',
        icon: 'ios-home',
        name: 'store',
        title: '我的门店',
        component: Main,
        children: [
            { path: 'store-list', title: '门店列表', name: 'store-list', icon: 'compose', component: () => import('@/views/my-components/store/store-list.vue') },
            { path: 'terminal', title: '门店终端', name: 'terminal',  component: () => import('@/views/my-components/store/terminal/index.vue'), hidden: true },
            { path: 'bindTerminal', title: '绑定终端', name: 'bindTerminal',  component: () => import('@/views/my-components/store/terminal/bindTerminal.vue'), hidden: true },
            { path: 'cloudSpeak', title: '云喇叭管理', name: 'cloudSpeaker',  component: () => import('@/views/my-components/store/terminal/cloudSpeak.vue'), hidden: true },
            { path: 'person-list', title: '店员列表', name: 'person-list', icon: 'person-stalker', component: () => import('@/views/my-components/store/person-list.vue') },
            { path: 'seach-score', title: '业绩查询', name: 'seach-score', icon: 'clipboard', component: () => import('@/views/my-components/store/seach-score.vue') }
        ]
    },
    {
        path: '/code',
        icon: 'ios-analytics',
        name: 'code',
        title: '收款二维码管理',
        component: Main,
        children: [
            // { path: 'data', icon: 'image', title: '二维码订单数据', name: 'order_code', component: () => import('@/views/my-components/order/code.vue') },
            { path: 'collect', icon: 'images', title: '收款二维码', name: 'collect', component: () => import('@/views/my-components/code/collect.vue') },
        ]
    },
    // {
    //     path: '/activity',
    //     icon: 'ios-pricetags',
    //     name: 'activity',
    //     title: '商家打折活动',
    //     component: Main,
    //     children: [
    //         { path: 'order', title: '活动订单数据', name: 'activity-order', icon: 'edit', component: () => import('@/views/my-components/activity/order.vue') },
    //         { path: 'list', title: '活动列表', name: 'activity-list', icon: 'arrow-move', component: () => import('@/views/my-components/activity/list.vue') }
    //     ]
    // },
    {
        path: '/system-notice',
        icon: 'android-volume-up',
        title: '系统通知',
        name: 'errorpage',
        component: Main,
        children: [
            { path: 'index', title: '系统通知', name: 'notice', component: () => import('@/views/my-components/system/notice.vue') }
        ]
    }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    ...appRouter,
    page500,
    page403,
    page404,
];
